package com.gientech.springexercise.controller.redis01;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @ClassName ProductController
 * @Description TODO
 * @Author zhangfantong
 * @Date 2023/2/16 20:09
 * @Version 1.0
 */
@RestController
public class ProductController {
    @Resource
    RedisTemplate redisTemplate;

    String key = "producer01";
    @GetMapping("/producer")
    public String providder(){
        // redis值
        String value = String.valueOf(new Date());
//        生产内容
        redisTemplate.opsForValue().set(key, value);

        return "生产成功key:"+key;
    }
}
